Enhance query handling in FilterFormFactory and flare.js#24
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the “keep query params on GET filter forms” behavior by replacing the legacy data-flare-keep-query marker with a structured data-flare-form="keep-query" attribute, and extends the query cleanup logic to also remove explicitly marked query fields.
Changes:
- Update the Symfony form factory output to render
data-flare-form="keep-query"on generated filter forms. - Update
flare.jsto target the new keep-query attribute and additionally delete query params for fields marked withdata-flare-form="query-field".
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Form/Factory/FilterFormFactory.php |
Updates generated filter form attributes to use data-flare-form="keep-query". |
public/frontend/flare.js |
Updates the selector and deletion logic to support structured form/query-field markers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates how filter forms handle query parameters in both the frontend JavaScript and form factory. The main change is a switch from the generic
data-flare-keep-queryattribute to a more structureddata-flare-form="keep-query"and the introduction of a dedicated selector for query fields. This improves clarity and maintainability in how forms preserve query parameters.Frontend JavaScript and form attribute updates:
data-flare-keep-querytodata-flare-form="keep-query"in both the JavaScript selector and the form factory output (flare.js,FilterFormFactory.php). [1] [2]flare.jsto use a new selector for query fields:[data-flare-form="query-field"], ensuring that any fields with this attribute are properly managed when cleaning up query parameters. [1] [2]